import requests
import json
import time

def dataGET():
   heads = {'content-type':'application/josn'}
   response = requests.get('http://192.168.10.100:8000/data')
   print(response.text)

def cmdPOST():
   payload = {
      'head': 1,
      'len': 2,
      'cmd': 4,
      'subCmd': 4,
      'data': [0, 1, 2]
   }
   heads = {'content-type':'application/josn'}
   response = requests.post('http://192.168.10.100:8000/cmdRegister', json=payload, headers = heads)
   print(response.text)

def resGET():
   payload = {
      'head': 1,
      'len': 2,
      'cmd': 4,
      'subCmd': 4,
      'data': [0, 1, 2]
   }
   print(json.dumps(payload))
   heads = {'content-type':'application/josn'}
   response = requests.get('http://192.168.10.100:8000/resRegister', json=payload, headers = heads)
   print(response.text)

if __name__ == '__main__':
   # cmdPOST()
   while 1:
      time.sleep(1)
      dataGET()
   # resGET()
